home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Texteditors / Origami / Sources / src / lib / refdecodetg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-27  |  546 b   |  30 lines

  1. /*{{{}}}*/
  2. /*{{{  includes*/
  3. #include <stdio.h>
  4.  
  5. #include <h/keys.h>
  6. #include <h/token.h>
  7. #include <h/rcformat.h>
  8. #include <lib/ori_rc_lib.h>
  9. /*}}}  */
  10.  
  11. /*{{{   ref_decode_tag*/
  12. int ref_decode_tag(unsigned char const *s)
  13. { int x,c;
  14.  
  15.   for (x=0;;)
  16.      switch((c= *s++))
  17.       { default:
  18.            if ((c-=REF_COUNT_BASE)<0)
  19.         case REF_NODE_LIMITER:
  20.         case '\0':
  21.               if (x&1)
  22.                  return(x>>1);
  23.               else
  24.                  return(-(x>>1));
  25.         x=x*REF_MODULO+c;
  26.         continue;
  27.       }
  28. }
  29. /*}}}  */
  30.